package com.lzk;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication//属于配置类
@EnableEurekaClient
//开启熔断器
@EnableCircuitBreaker
public class OrderApp {

    public static void main(String[] args) {
        SpringApplication.run(OrderApp.class,args);
    }



    @Bean   //在配置类里面将restTemplate交给springfactory工厂管理
    @LoadBalanced   //开启均衡负载
    RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
